//
//  HBCoinFooterView.m
//  HeartBeat
//
//  Created by karong on 2023/9/11.
//

#import "HBCoinFooterView.h"
@interface HBCoinFooterView ()

@property (weak, nonatomic) IBOutlet YYLabel *label;

@end
@implementation HBCoinFooterView
- (void)awakeFromNib {
    [super awakeFromNib];
    self.label.attributedText = [HBCoinFooterView vipTextWithTapAction:^(NSString *string1, NSString *string2) {
        if ([self.delegate respondsToSelector:@selector(vipFooterViewWebAction:title:)]) {
            [self.delegate vipFooterViewWebAction:string1 title:string2];
        }
    }];
}

+ (NSMutableAttributedString *)vipTextWithTapAction:(回调两个字符串)tapAction {
    NSMutableParagraphStyle *style = [[NSMutableParagraphStyle alloc] init];
    style.alignment = NSTextAlignmentLeft;
    style.lineBreakMode = NSLineBreakByWordWrapping;
    NSString *text = WSLocalized(@"充值說明：\n\n1. 充值不支持退款；\n2. 充值的書幣僅適用本平台；\n3.當交易失敗時，請聯繫我們的客服服務，我們將在1個工作日幫您處理");
    NSMutableAttributedString *attrText = [[NSMutableAttributedString alloc] initWithString:text
                                                                                 attributes:@{NSFontAttributeName: [UIFont systemFontOfSize:12], NSParagraphStyleAttributeName: style, NSForegroundColorAttributeName: UIColor.font_gray_999999}];
    return attrText;
}

+ (CGFloat)cellHeight {
    CGFloat height = [[self vipTextWithTapAction:nil] boundingRectWithSize:CGSizeMake(HBScreenWidth - 31, MAXFLOAT) options:NSStringDrawingUsesLineFragmentOrigin | NSStringDrawingUsesFontLeading context:nil].size.height;
    return  height;
}
@end
